package com.ceba.test.modules.admin.entity;

import java.util.Map;

import abc.util.StringUtils;
import com.ceba.test.base.configs.CebaPathUtil;
import com.ceba.base.web.entity.IBase;
import com.ceba.cebautils.StringUtil;
import com.ceba.test.modules.admin.vo.QiFengStampVo;
import io.netty.handler.codec.json.JsonObjectDecoder;
import org.json.JSONObject;


public class QfRule extends IBase{

	private static final long serialVersionUID = 7L;
	
	private String id="";
	private String cusfaceName="";
	
	//骑缝章的配置规则字段
	private int cusPosition;//加盖骑缝章的位置 0-上边缘  1-左边缘  2-下边缘 3-右边缘
	private int cusVerticalApeak;//边缘垂直占比  1-9 分别表示10%-90% 
	private int odevity;//骑缝章加盖的奇偶数  0-偶数 1-奇数 2-全部
	
	private int syncopate;//骑缝章的切割方式  0-均分  1-特殊情况  2-随机
	private int fristApeak;//切割方式方式特殊情况下 首页占比 1-9 分别表示10%-90% 
	private int outherApeak;//切割方式方式特殊情况下 其他页0-均分 1-随机
	
	private String filePath = CebaPathUtil.getVisualtransPic();//骑缝章路径
	
	private float imgWidth = 75;//宽
	
	private float imgHeight = 75;//高

	//用于权限控制
	private boolean isSelect = false;

	//文件存储地址ID
	private String storageAddressId;



	public String getStorageAddressId() {
		return storageAddressId;
	}

	public void setStorageAddressId(String storageAddressId) {
		this.storageAddressId = storageAddressId;
	}

	public boolean isSelect() {
		return isSelect;
	}

	public void setSelect(boolean select) {
		isSelect = select;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getCusfaceName() {
		return cusfaceName;
	}
	public void setCusfaceName(String cusfaceName) {
		this.cusfaceName = cusfaceName;
	}



	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	
	
	public int getCusPosition() {
		return cusPosition;
	}
	public void setCusPosition(int cusPosition) {
		this.cusPosition = cusPosition;
	}
	public int getCusVerticalApeak() {
		return cusVerticalApeak;
	}
	public void setCusVerticalApeak(int cusVerticalApeak) {
		this.cusVerticalApeak = cusVerticalApeak;
	}
	public int getOdevity() {
		return odevity;
	}
	public void setOdevity(int odevity) {
		this.odevity = odevity;
	}
	

	public int getSyncopate() {
		return syncopate;
	}
	public void setSyncopate(int syncopate) {
		this.syncopate = syncopate;
	}
	public int getFristApeak() {
		return fristApeak;
	}
	public void setFristApeak(int fristApeak) {
		this.fristApeak = fristApeak;
	}
	public int getOutherApeak() {
		return outherApeak;
	}
	public void setOutherApeak(int outherApeak) {
		this.outherApeak = outherApeak;
	}
	
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	

	
	public float getImgWidth() {
		return imgWidth;
	}
	public void setImgWidth(float imgWidth) {
		this.imgWidth = imgWidth;
	}
	public float getImgHeight() {
		return imgHeight;
	}
	public void setImgHeight(float imgHeight) {
		this.imgHeight = imgHeight;
	}
	/*
	 * 解析从前台字典数据封装成对象
	 */
	public static QfRule parseFromFront(JSONObject dic) {
			QfRule cus_Resouse = new QfRule();
		
		if(dic.has("ID")){
			cus_Resouse.setId((String)dic.get("ID"));
		}
		if(dic.has("CusfaceName") ){
			cus_Resouse.setCusfaceName((String)dic.get("CusfaceName"));
		}
		if(dic.has("position") &&!StringUtil.isEmptyString((String)dic.get("position"))){
			cus_Resouse.setCusPosition(Integer.parseInt((String)dic.get("position")));
		}
		if(dic.has("verticalApeak") &&!StringUtil.isEmptyString((String)dic.get("verticalApeak"))){
			cus_Resouse.setCusVerticalApeak(Integer.parseInt((String)dic.get("verticalApeak")));
		}
		if(dic.has("odevity") &&!StringUtil.isEmptyString((String)dic.get("odevity"))){
			cus_Resouse.setOdevity(Integer.parseInt((String)dic.get("odevity")));
		}
		if(dic.has("syncopate") &&!StringUtil.isEmptyString((String)dic.get("syncopate"))){
			cus_Resouse.setSyncopate(Integer.parseInt((String)dic.get("syncopate")));
		}
		if(dic.has("fristApeak") && !StringUtil.isEmptyString((String)dic.get("fristApeak"))){
		   cus_Resouse.setFristApeak(Integer.parseInt((String)dic.get("fristApeak")));
		}
		if(dic.has("outherApeak") &&!StringUtil.isEmptyString((String)dic.get("outherApeak"))){
			cus_Resouse.setOutherApeak(Integer.parseInt((String)dic.get("outherApeak")));
		}
		if(dic.has("imgWidth") &&!StringUtil.isEmptyString((String)dic.get("imgWidth"))){
			cus_Resouse.setImgWidth(Float.parseFloat((String)dic.get("imgWidth")));
		}
		if(dic.has("imgHeight") &&!StringUtil.isEmptyString((String)dic.get("imgHeight"))){
			cus_Resouse.setImgHeight(Float.parseFloat((String)dic.get("imgHeight")));
		}
		return cus_Resouse;
		
	}

	public static QfRule parseFromFront(QiFengStampVo qiFengStampVo) {
		QfRule cus_Resouse = new QfRule();
		cus_Resouse.setId(qiFengStampVo.getID());
		cus_Resouse.setCusfaceName(qiFengStampVo.getCusfaceName());
		cus_Resouse.setCusPosition(qiFengStampVo.getPosition());
		cus_Resouse.setCusVerticalApeak(Integer.parseInt(qiFengStampVo.getVerticalApeak()));
		cus_Resouse.setOdevity(qiFengStampVo.getOdevity());
		cus_Resouse.setSyncopate(qiFengStampVo.getSyncopate());
		if(qiFengStampVo.getFristApeak()!=null && !qiFengStampVo.getFristApeak().equals("")){
			cus_Resouse.setFristApeak(Integer.valueOf(qiFengStampVo.getFristApeak()));
		}
		if(qiFengStampVo.getOutherApeak() != null && !qiFengStampVo.getOutherApeak().equals("")){
			cus_Resouse.setOutherApeak(Integer.valueOf(qiFengStampVo.getOutherApeak()));
		}
		if(!StringUtils.isNullOrEmpty(qiFengStampVo.getImgWidth())){
			cus_Resouse.setImgWidth(qiFengStampVo.getImgWidth());
		}
		if(!StringUtils.isNullOrEmpty(qiFengStampVo.getImgHeight())){
			cus_Resouse.setImgHeight(qiFengStampVo.getImgHeight());
		}
		return cus_Resouse;
	}
	
}
